<template>
    
</template>

<script>
    module.exports = {
        props: {
            title: {
                type: String,
                default: ''
            },
            text: {
                type: String,
                default: ''
            }
        },
        mounted: function () {
            let self = this;
            swal({
                    title: this.title,
                    text: this.text,
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确认",
                    cancelButtonText: "取消",
                    closeOnConfirm: false,
                    closeOnCancel: true,
                    showLoaderOnConfirm: true
                },
                function (isConfirm) {
                    if (isConfirm) {
                        self.$emit('on-confirm');
                    }else{
                        self.$emit('on-cancel');
                    }
                }
            );
        },
        destroyed: function () {
            swal.close();
        }
    }
</script>